package com.monkey.helper

/**
 * 作者：Monkey
 * 日期：2018/1/28
 */
object ResourcesHelper {
    fun readAllInt(path: String): List<Int> {
        val inputStream = Thread.currentThread().contextClassLoader.getResourceAsStream(path)
        return inputStream.bufferedReader().readLines().map { it.trim().toInt() }
    }

    fun readAllString(path: String): Array<String> {
        val inputStream = Thread.currentThread().contextClassLoader.getResourceAsStream(path)
        return inputStream.bufferedReader().readLines().map { it.trim() }.toTypedArray()
    }

    fun readLine(path: String): String {
        val inputStream = Thread.currentThread().contextClassLoader.getResourceAsStream(path)
        return inputStream.bufferedReader().readLine()
    }
}